<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="x" uri="/soar-bx-tags"%>
<html>
<head>
<title>海关辅助查验平台登录页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="<x:Context/>/assets/js/jquery.min.js"></script>
<script type="text/javascript" src="<x:Context/>/assets/js/placeholder.js"></script>
		<!--[if IE 7]>
		<script type="text/javascript" src="<x:Context/>/assets/js/IEjs.js">></script>
		<![endif]-->
		<!--[if IE 8]>
		<script type="text/javascript" src="<x:Context/>/assets/js/IEjs.js">></script>
		<![endif]-->
<link rel="stylesheet" type="text/css" href="<x:Context/>/assets/css/login.css">
</head>
<body>
<div class="total">
	<div class="top clear">
    <img src="<x:Context/>/assets/images/lg_logo.png">
    </div>
	<div class="login-wrap">
		<div class="login-newbg"></div>
        <div class="login-layout">
           <div class="login-box-warp">
           <div class="login-box static-form">
           		<!--<div class="login-title">用户登录</div>-->
		        <div style="width:300px;">
                <div id="J_Message" class="login-msg error clear" style="display:none;"> 
				<span class="msg-img"><img src="<x:Context/>/assets/images/login_msg.png" height="15px"></span>
				<p id="Error_Message" class="error"></p>
			
		     </div>
			<div class="field username-field">
				<label for="TPL_username_1"> <i class="iconfont" title="用户名"><img src="<x:Context/>/assets/images/username.jpg"></i></label>
			
                <input type="text"  id="mobile" class="login-text J_UserName"  maxlength="32" tabindex="1"  placeholder="请输入用户名" onkeyup="threeH()">
			</div>

			<div class="field pwd-field">
				<label id="password-label" for="TPL_password_1"><i class="icon iconfont" title="登录密码"><img src="<x:Context/>/assets/images/password.jpg"></i></label> 
				
				<!--[if gte IE 6]>
				<input type="password" id="password" class="login-text"  maxlength="40"  onkeyup="threeH()">
				<![endif]-->
				<!--[if !IE]><!-->
				   <input type="password" id="password"  class="login-text" placeholder="请输入密码" maxlength="40"  onkeyup="threeH()">
				<!--<![endif]-->
			</div>
			<div class="field ver-field clear" >
                <div style="float:left;width:200px;">
				<label id="vercode-label" for="TPL_vercode_1"><i class="icon iconfont" title="验证码"><img src="<x:Context/>/assets/images/vercode.jpg"></i></label> 

                	
				   <input type="text" id="vcode"  class="login-text-pass" maxlength="20"  placeholder="验证码" onkeyup="threeH()">
                   </div>
				<div style="margin-top:2px;float:right; width:81px;"><a href="javascript:" id="relodavc" onclick="$('.imgcode').attr('src','<x:Context/>/servlet/validateCodeServlet?'+new Date().getTime());"><img class="imgcode" src="<x:Context/>/servlet/validateCodeServlet"></a></div>
			</div>
			
			

			
			<div class="submit">
				
				<button type="submit" class="J_Submit" tabindex="3" id="J_SubmitStatic" data-ing="正在登录..." data-form-sbm="1478846212781.8713" onclick="loginTasker()">登 录</button>
			</div></div>
           </div>
           
           
           </div>
        
        </div>

	</div>
<div class="footer"></div>
</div>
			<script type="text/javascript">
				document.onkeyup=function(e)
				{
					var currKey=0,e=e||event;
	　　      　   		currKey=e.keyCode||e.which||e.charCode;
					if(currKey == 13)
					{
						loginTasker();
					}
				}
			
				function loginTasker(){
					var mobile="";
					var password="";
					var vcode="";
					
					 mobile=$("#mobile").val();
					 password=$("#password").val();
					 vcode=$("#vcode").val();
					 if(mobile !=""){
					 	if(password=="")
							{
								$("#Error_Message").text("请输入密码");
								$("#J_Message").show();
								setTimeout("threeS()",2000);
							}else{
								userlogin(mobile,password,vcode);
							}
					 }else{
							$("#Error_Message").text("请输入用户名");
							$("#J_Message").show();
							setTimeout("threeS()",2000);
					 }
					 
				};
				
				function threeS(){
					$("#J_Message").show();
				};
				
				function threeH(){
					$("#J_Message").hide();
					//$("#Error_Message").text("");
				};
				
				
				function  userlogin(mobile,password,vcode){
					
					 	 $.ajax({
			            type:"POST",
			            url:"<x:Context/>/login.shtml",
			            data:{mobile:mobile,password:password,validateCode:vcode},
			            success:function(data){
			            var jdata=$.parseJSON(data)
			            var re=jdata.result;
			            var em=jdata.errmsg;
			            		if("1"==re){
									location.href="<x:Context/>/welcome.shtml"
								}else{
									$("#Error_Message").text(em);
									$("#J_Message").show();
									setTimeout("threeS()",5000);
									$("#vcode").val("");
									$("#relodavc").click();
								}
			           		
			            },
			            error: function(){
			                $("#Error_Message").text("网络错误");
							$("#J_Message").show();
							setTimeout("threeS()",2000);
							location.href="<x:Context/>/login.jsp"
			            }         
			         }); 
					 	
				};
			</script>
</body>
</html>

